package com.hice.demo.java.concurrent;

import java.util.concurrent.SynchronousQueue;

/**
 * 同步队列 SynchronousQueueExample
 *
 * @author hyson
 * @create 2017-03-13 11:31
 */
public class SynchronousQueueExample {

    public static void main(String[] args) {
        SynchronousQueue<String> queue = new SynchronousQueue<>();
        try {
            //System.out.println(queue.take());
            Thread.sleep(1000);
            queue.put("测试");
            System.out.println(queue.take());
        } catch (InterruptedException e) {
            System.out.println("异常");
        }
    }
}
